<template>
  <div class="popups">
    <p style="color: #666;">支付金额（元）<img src="/static/img/close.png" alt="" class="close" @click="close"></p>
    <p class="actual">{{actual}}</p>
    <p class="chooseWay">请选择支付方式</p>
    <van-radio-group v-model="radio" @change="radioChange" class="choose" >
      <van-radio v-for="(v,i) in data" :key="i" v-if="i==2||i==1" :name="v.pay_id">
        <img :src="v.pay_logo" alt="">
        {{v.pay_name}}
      </van-radio>
    </van-radio-group>
    <div class="submit" @click="onSubmit">提交</div>
  </div>
</template>

<script>
  import request from "@/actions/request.js"
  export default {
    name: "alertPay",
    props:['data','actual','order_sn'],
    data(){
      return{
        radio:3,
        isWeixinBlean:'',
        aliPay:{
          body: "",
          notify_url: "",
          out_trade_no: "",
          partner: "",
          payment_type: "",
          return_url: "",
          seller_id: "",
          service: "",
          show_url: "",
          subject: "",
          total_fee: "",
          url: "",
          sign:'',
          _input_charset: "",
        },
        show:false,
      }
    },
    // props:[],
    watch:{
      aliPay(newVal,oldVal){
        setTimeout(function(){
          document.getElementById('alipaysubmit').submit();
        },200)

      }
    },
    methods:{
      radioChange(e){
        this.radio=e.mp.detail;
      },
      close(){
        this.$emit('close',)
      },
      onSubmit(){
        this.$emit('submitOrder',this.radio)
       /* request.getPay('api/shop/getPay','post',{
          pay_id:this.radio,
          order_sn:this.order_sn,
          wx_openid:wx.getStorageSync('openid'),
        },{},true,this)*/
      },
      onBridgeReady(){

      },
      isWeiXin() {
        /*var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == 'micromessenger') {
          this.radio=0;
          return true;
        } else {
          return false;
        }*/
      }
    },
    mounted(){
      this.isWeixinBlean=this.isWeiXin()
    }
  }
</script>

<style scoped lang="scss">
  .popups{
    width: 241px;
    height: 340px;
    border-radius: 1vw;
    top: 0;right: 0;bottom: 0;
    margin: auto;
    padding: 2.5vw 2vw;
    .submit{
      width: 150px;
      height: 10.33vw;
      background: #ff4c50;
      font-size: 18px;
      margin: 0px auto;
      border-radius: 13vw;
      line-height: 10.33vw;
      text-align: center;
      color: #fff;
      position: absolute;
      bottom: 30px;
      left: 75px;
    }
    .choose{
      width: 100%;
      height: 10vw;
      img{
        width: 4vw;
        height: 4vw;
        position: relative;
        top: .5vw;
      }
    }
    .chooseWay{
      color: #666;
      font-size: 13px;
    }
    .actual{
      width: 100%;
      height: 24vw;
      color: #333;
      font-size: 30px;
      text-align: center;
      line-height: 24vw;

    }
    .close{
      width: 4vw;
      height: 4vw;
      float: right;
    }
  }


</style>
<style>

.van-radio .van-icon-checked{
    color: #ff4c50!important;
  }
  .van-radio{
    line-height: 9vw;
    height:8vw;
    margin-top:3vw;
  }
  .van-radio__input{
    float: right;
    font-size: 15px;
  }
</style>
